<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Post_model extends CI_Model{

	function list_posts($num, $offset){
		$this->db->select('*');
        $this->db->from('posts');
        $this->db->join('images', 'storyid = posts.id');
        $this->db->limit($num, $offset);
        $this->db->order_by("dateadded", "desc");
        $query = $this->db->get();
        return $query->result();
	}
}